﻿import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts

Item {
    id: control

    // var
    property var items: []
    property real item_height: 30

    // signal

    // Model Format
    QtObject {
        id: id_qtobject__modelformat
        property string title: ""
        property string icon: ""

    }

    ListModel {
        id: id_listmodel
        ListElement { title: "file_1";   is_file: true  }
        ListElement { title: "folder_1"; is_file: false }
        ListElement { title: "file_2";   is_file: true  }
        ListElement { title: "file_3";   is_file: true  }
        ListElement { title: "folder_3"; is_file: false }
    }

    ScrollView {
        width: parent.width
        height: parent.height
        ListView {
            id: id_listview
            anchors.fill: parent
            orientation: ListView.Vertical
            model: id_listmodel
            clip: true

            // delegate
            delegate: Item {
                height: id_rowlayout.height
                width:  id_rowlayout.width
                RowLayout {
                    id: id_rowlayout
                    height: control.item_height
                    Image {
                        clip: true
                        id: id_image__icon
                        source: /*is_file*/false ? "qrc:/res/image/file.png" : "qrc:/res/image/folder.png"
                        sourceSize.height: 30
                        sourceSize.width: 30
                    }
                    Text {
                        id: id_text_title
                        text: model.title
                        Layout.fillWidth: true
                    }
                }
            }
        }
    }
}
